package com.xiaozhu.common;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.xiaozhu.common.https.HttpsActivity;
import com.xiaozhu.common.list.ListActivity;
import com.xiaozhu.common.toggle.SwitchButtonActivity;
import com.xiaozhu.common.video.VideoListActivity;
import com.xiaozhu.library.activity.BaseActivity;
import com.xiaozhu.library.activity.ExceptionActivity;
import com.xiaozhu.library.download.DownloadFileActivity;
import com.xiaozhu.library.download.FileType;
import com.xiaozhu.library.entity.EventBusEntity;
import com.xiaozhu.library.widget.custom.TitleBarView;
import com.xiaozhu.umeng.UmengUtils;


/**
 * @说明
 * @作者 LY
 * @时间 2017/12/18 10:46
 * @邮箱 2743569843@qq.com
 * @版权 Copyright(c) 2017 LY-版权所有
 * @备注
 */
public class MainActivity extends BaseActivity implements View.OnClickListener {
    private TitleBarView titleBarView;
    private TextView btnList;
    private TextView btnVideoList;
    private TextView btnSwitch;
    private TextView btnException, btnHttps,btnDownload;

    @Override
    public void initView() {
        titleBarView = this.findViewById(R.id.titleBar);
        btnList = this.findViewById(R.id.btnList);
        btnVideoList = this.findViewById(R.id.btnVideoList);
        btnSwitch = this.findViewById(R.id.btnSwitch);
        btnException = this.findViewById(R.id.btnException);
        btnHttps = this.findViewById(R.id.btnHttps);
        btnDownload = this.findViewById(R.id.btnDownload);

        titleBarView.setTitle("测试标题");

        btnList.setOnClickListener(this);
        btnVideoList.setOnClickListener(this);
        btnSwitch.setOnClickListener(this);
        btnException.setOnClickListener(this);
        btnHttps.setOnClickListener(this);
        btnDownload.setOnClickListener(this);
    }

    @Override
    public void business() {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btnList:
                startActivity(new Intent(this, ListActivity.class));
                break;
            case R.id.btnVideoList:
                startActivity(new Intent(this, VideoListActivity.class));
                break;
            case R.id.btnSwitch:
                startActivity(new Intent(this, SwitchButtonActivity.class));
                break;
            case R.id.btnException:
                ExceptionActivity.startException(this);
                break;
            case R.id.btnHttps:
                startActivity(new Intent(this, HttpsActivity.class));
                break;
            case R.id.btnDownload:
                String url = "http://gdown.baidu.com/data/wisegame/e2ec5ae15b93fdaa/anzhuoshichang_16793302.apk";
                DownloadFileActivity.startDownload(this,url,FileType.APK.ordinal());
                break;
        }
    }

    @Override
    public int getLayoutResID() {
        return R.layout.activity_main;
    }
}
